<template>
	<view>
		<scroll-view scroll-x="true" class="border-bottom" style="height: 422upx;">
			<view class="d-flex">
				<view v-for="(item, index) in dataList" :key="index" @tap="skipToNewsDetail(item.contentId,item.url)" style="width: 498rpx;height: 362rpx;" class="d-flex flex-column py-3 mr-3">
					<image :src="item.thumb" style="height: 255rpx;width: 498rpx;" mode=""></image>
					<view>
						<text class="font-30" style="line-height: 48upx;">{{ item.title }}</text>
					</view>					
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
export default {
	props: {
		dataList: {
			type: Array,
			default: () => {
				return [];
			}
		}
	},
	methods:{
		skipToNewsDetail(newsId,url){
			uni.navigateTo({
				url:'/pages/index/news-detail/news-detail?id=' + newsId + '&link=' + url
			})
			//加入历史记录
			// console.log("33")
			// let obj = {
			// 	newsId,url
			// }
			// let list = uni.getStorageSync('history')
			// list = list ? JSON.parse(list) : [];
			// let index = list.findIndex(v=>v.id === newsId)
			// if(index === -1){
			// 	 list.unshift(obj);
			//      uni.setStorageSync('history',JSON.stringify(list))
			// }
		}
	}
};
</script>

<style></style>
